﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TamTreSoSinh.DBContext;

namespace TamTreSoSinh.Admin
{
    public partial class SettingShoppingCategory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void LoadData()
        {
            DBTamTreEntities dbContext = new DBTamTreEntities();

            List<ShoppingCategory> listShoppingCategory = dbContext.ShoppingCategories.OrderBy(obj => obj.Priority).ToList();

            GridView1.DataSource = listShoppingCategory;
            GridView1.DataBind();
        }

        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            Response.Redirect(@"/Admin/SettingShoppingCategoryDetail.aspx");
        }
    }
}